
/*
 * GET home page.
 */

var Post = require('../model/post.js');

var UserCollection = require('../model/userCollection.js');

exports.index = function(req, res){
    Post.getByNum(6,function(err,result){
        var posts = [];
        if(!err || result){
            posts = result;
        };

        res.render('index', {
            title: '首页',
            posts: posts,
            user : req.session.user,
            success : req.flash('success').toString(),
            error : req.flash('error').toString()
        });
    });
};


